package com.sgb.kjwl.view.ui.fragment.enterprise;

import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.sgb.kjwl.AppFragment;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.FragmentMakeOverBinding;
import com.sgb.kjwl.di.enterprise.DaggerEnterpriseFragComponent;
import com.sgb.kjwl.di.enterprise.EnterpriseFragModule;
import com.sgb.kjwl.model.entity.enterprise.CompanyListEntity2;
import com.sgb.kjwl.model.entity.enterprise.IpPickSelectEntity;
import com.sgb.kjwl.model.entity.enterprise.PropertyEntity;
import com.sgb.kjwl.utils.PickPriceUtils;
import com.swgk.core.event.EventConstant;
import com.sgb.kjwl.view.event.LoginEvent;
import com.sgb.kjwl.view.ui.adapter.enterprise.CompanyAdapter;
import com.sgb.kjwl.view.ui.adapter.enterprise.PropertyAdapter;
import com.sgb.kjwl.view.widget.IpPopWindow;
import com.sgb.kjwl.view.widget.IpPricePopWindow;
import com.sgb.kjwl.view.widget.MakeOverMoreFilterPopWindow;
import com.sgb.kjwl.viewmodel.enterprise.MakeOverModel;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.dialog.BasePopWindow;
import com.swgk.core.xrecyclerview.XRecyclerView;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Inject;

public class MakeOverFragment extends AppFragment {

    private FragmentMakeOverBinding binding;
    private String type;

    @Inject
    MakeOverModel model;


    private boolean isLoadMore = false;
    //商品no
    private String brandNo;
    //出售价格
    private String minPrice, maxPrice;
    //组合类型
    private String groupType;
    //字符长度
    private String charLength;
    //版权分类
    private String copyrightType;
    //是否独家
    private String isOnce;
    //行业类型no
    private String tradeType;
    //专利类型no
    private String patentType;
    //专利状态
    private String patentStatus;
    //企业类型
    private String companyType;
    //纳税类型
    private String ratePayingType;
    //资产新旧
    private String newOrOld;
    //资产分类
    private String propertyType;
    //发布类型
    private String publishType;

    private IpPopWindow brandPopWindow;//商标分类
    private IpPricePopWindow pricePopWindow;//出售价格-商标
    private IpPopWindow makeupPopWindow;//组合类型
    private IpPopWindow lengthPopWindow;//字符长度
    private MakeOverMoreFilterPopWindow moreWindow;

    private int trademarkPageNumber = 1;
    private int copyrightPageNumber = 1;
    private int patentPageNumber = 1;
    private int companyPageNumber = 1, propertyPageNumber = 1;

    private CompanyAdapter companyAdapter;
    private PropertyAdapter propertyAdapter;
    private boolean isChange1 = false, isChange2 = false, isChange3 = false, isChange4 = false;
    List<IpPickSelectEntity> listPrice = new ArrayList<>();
    private String category = "";

    public static MakeOverFragment newInstance(String param1, String category) {
        MakeOverFragment fragment = new MakeOverFragment();
        Bundle args = new Bundle();
        args.putString("makeOverType", param1);
        args.putString("category", category);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected void setupFragmentComponent(AppComponent appComponent) {
        DaggerEnterpriseFragComponent.builder().appComponent(appComponent)
                .enterpriseFragModule(new EnterpriseFragModule(this))
                .build()
                .inject(this);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = DataBindingUtil.inflate(inflater, R.layout.fragment_make_over, container, false);
        return binding.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        type = getArguments().getString("makeOverType");
        category = getArguments().getString("category");

        assert type != null;
        setDataLoadMore(type, true);

        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }

        brandPopWindow = new IpPopWindow(getActivity());
        brandPopWindow.setBgView(binding.grayLayout);
        brandPopWindow.setOnResultClick((type, key2, key3) -> {
            String name = ((IpPickSelectEntity) type).getName();
            if (!name.equals("不限")) {
                isChange1 = true;
                setTextViewBg(binding.tvType, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
            } else {
                isChange1 = false;
                setTextViewBg(binding.tvType, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
            }
            switch (MakeOverFragment.this.type) {
                case "商标":
                case "版权":
                case "专利":
                    break;
                case "公司":
                    tradeType = ((IpPickSelectEntity) type).getValue();
                    break;
                case "资产":
                    if (!"不限".equals(((IpPickSelectEntity) type).getName())) {
                        propertyType = ((IpPickSelectEntity) type).getValue();
                    } else {
                        propertyType = "";
                    }
                    newOrOld = "";
                    isChange4 = false;
                    if (lengthPopWindow != null) {
                        lengthPopWindow.setDefItem(0);
                    }
                    // TODO: 2021/4/1 待添加 关联
                    if (((IpPickSelectEntity) type).getRelateOld() != null && ((IpPickSelectEntity) type).getRelateOld().equals("0")) {
                        binding.tvArea.setVisibility(View.VISIBLE);
                        setTextViewBg(binding.tvArea, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                    } else {
                        binding.tvArea.setVisibility(View.GONE);
                    }
                    break;
            }
            setDataLoadMore(MakeOverFragment.this.type, true);
        });
        brandPopWindow.setOnDismissListener(() -> {
            if (!isChange1) {
                setTextViewBg(binding.tvType, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.tvType, 2);
            } else {
                setDrwImage(binding.tvType, 1);
            }
        });

        pricePopWindow = new IpPricePopWindow(getActivity());
        pricePopWindow.setBgView(binding.grayLayout);
        pricePopWindow.setOnResultClick((type, key2, key3) -> {
            String name = ((IpPickSelectEntity) type).getName();
            if (!name.equals("不限")) {
                isChange2 = true;
                setTextViewBg(binding.tvTime, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
            } else {
                isChange2 = false;
                setTextViewBg(binding.tvTime, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
            }
            switch (MakeOverFragment.this.type) {
                case "商标":
                case "版权":
                case "专利":
                    break;
                case "公司":
                    companyType = ((IpPickSelectEntity) type).getValue();
                    break;
                case "资产":
                    maxPrice = PickPriceUtils.getMaxPrice((IpPickSelectEntity) type);
                    minPrice = PickPriceUtils.getMinPrice((IpPickSelectEntity) type);
                    break;
            }
            setDataLoadMore(MakeOverFragment.this.type, true);
        });
        pricePopWindow.setOnDismissListener(() -> {
            if (!isChange2) {
                setTextViewBg(binding.tvTime, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.tvTime, 2);
            } else {
                setDrwImage(binding.tvTime, 1);
            }
        });


        makeupPopWindow = new IpPopWindow(getActivity());
        makeupPopWindow.setBgView(binding.grayLayout);
        makeupPopWindow.setOnResultClick((type, key2, key3) -> {
            String name = ((IpPickSelectEntity) type).getName();
            if (!name.equals("不限")) {
                isChange3 = true;
                setTextViewBg(binding.tvMoney, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
            } else {
                isChange3 = false;
                setTextViewBg(binding.tvMoney, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
            }
            switch (MakeOverFragment.this.type) {
                case "商标":
                case "版权":
                case "专利":
                    break;
                case "公司":
                    ratePayingType = ((IpPickSelectEntity) type).getValue();
                    break;
                case "资产":
                    publishType = ((IpPickSelectEntity) type).getPublishType();
                    break;
            }
            setDataLoadMore(MakeOverFragment.this.type, true);
        });
        makeupPopWindow.setOnDismissListener(() -> {
            if (!isChange3) {
                setTextViewBg(binding.tvMoney, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.tvMoney, 2);
            } else {
                setDrwImage(binding.tvMoney, 1);
            }
        });

        lengthPopWindow = new IpPopWindow(getActivity());
        lengthPopWindow.setBgView(binding.grayLayout);
        lengthPopWindow.setOnResultClick((type, key2, key3) -> {
            String name = ((IpPickSelectEntity) type).getName();
            if (!name.equals("不限")) {
                isChange4 = true;
                setTextViewBg(binding.tvArea, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
            } else {
                isChange4 = false;
                setTextViewBg(binding.tvArea, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
            }
            switch (MakeOverFragment.this.type) {
                case "商标":
                case "版权":
                case "专利":
                    break;
                case "公司":
                case "资产":
                    newOrOld = ((IpPickSelectEntity) type).getId();
                    break;
            }
            setDataLoadMore(MakeOverFragment.this.type, true);
        });
        lengthPopWindow.setOnDismissListener(() -> {
            if (!isChange4) {
                setTextViewBg(binding.tvArea, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.tvArea, 2);
            } else {
                setDrwImage(binding.tvArea, 1);
            }
        });

        binding.displayView.setLoadingListener(new XRecyclerView.LoadingListener() {
            @Override
            public void onRefresh() {
                isLoadMore = false;
                setDataLoadMore(type, true);
            }

            @Override
            public void onLoadMore() {
                isLoadMore = true;
                setDataLoadMore(type, false);
            }
        });

        initText(type);

        binding.displayView.setLayoutManager(new LinearLayoutManager(getContext()));
        switch (type) {
            case "公司":
                companyAdapter = new CompanyAdapter(getContext(), null, false);
                binding.displayView.setAdapter(companyAdapter);
                break;
            case "资产":
                propertyAdapter = new PropertyAdapter(getContext(), null);
                binding.displayView.setAdapter(propertyAdapter);
                break;
        }
        moreWindow = new MakeOverMoreFilterPopWindow(getContext());
        moreWindow.setOnResultCallBack(new BasePopWindow.OnResultCallBack<IpPickSelectEntity>() {
            @Override
            public void result(IpPickSelectEntity result) {
                if (null == result) {
                    resetAllChoose();
                } else {
                    maxPrice = PickPriceUtils.getMaxPrice(result);
                    minPrice = PickPriceUtils.getMinPrice(result);
                    //发布类型
                    publishType = result.getPublishType();
                    setDataLoadMore(MakeOverFragment.this.type, true);
                }
            }
        });
        moreWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                moreWindow.resetWindow();
            }
        });


        brandPopWindow.setBackground(R.color.white_translation);
        pricePopWindow.setBackground(R.color.white_translation);
        makeupPopWindow.setBackground(R.color.white_translation);
        lengthPopWindow.setBackground(R.color.white_translation);

        binding.tvType.setOnClickListener(this);
        binding.tvTime.setOnClickListener(this);
        binding.tvMoney.setOnClickListener(this);
        binding.tvArea.setOnClickListener(this);
        binding.tvMoreChoose.setOnClickListener(this);
    }

    /**
     * 还原所有筛选项
     */
    private void resetAllChoose() {
        setTextViewBg(binding.tvType, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
        setDrwImage(binding.tvType, 2);
        setTextViewBg(binding.tvTime, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
        setDrwImage(binding.tvTime, 2);
        setTextViewBg(binding.tvMoney, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
        setDrwImage(binding.tvMoney, 2);
        isChange1 = false;
        isChange2 = false;
        isChange3 = false;
        brandPopWindow.setDefItem(0);
        pricePopWindow.setDefItem(0);
        makeupPopWindow.setDefItem(0);
        tradeType = null;
        companyType = null;
        ratePayingType = null;
        maxPrice = null;
        minPrice = null;
        companyPageNumber = 1;
        //发布类型
        publishType = null;
        setDataLoadMore(type, true);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_type:
                if (!isChange1) {
                    if (!brandPopWindow.isShowing()) {
                        setTextViewBg(binding.tvType, R.drawable.search_bg, R.mipmap.icon_down_red, R.color.color_main);
                        setDrwImage(binding.tvType, 0);
                    }
                } else {
                    if (!brandPopWindow.isShowing()) {
                        setDrwImage(binding.tvType, 0);
                    }
                }
                clickOne(type);
                break;
            case R.id.tv_time:
                if (!isChange2) {
                    if (!pricePopWindow.isShowing()) {
                        setTextViewBg(binding.tvTime, R.drawable.search_bg, R.mipmap.icon_down_red, R.color.color_main);
                        setDrwImage(binding.tvTime, 0);
                    }
                } else {
                    if (!pricePopWindow.isShowing()) {
                        setDrwImage(binding.tvTime, 0);
                    }
                }
                clickTwo(type);
                break;
            case R.id.tv_money:
                if (!isChange3) {
                    if (!makeupPopWindow.isShowing()) {
                        setTextViewBg(binding.tvMoney, R.drawable.search_bg, R.mipmap.icon_down_red, R.color.color_main);
                        setDrwImage(binding.tvMoney, 0);
                    }
                } else {
                    if (!makeupPopWindow.isShowing()) {
                        setDrwImage(binding.tvMoney, 0);
                    }
                }
                clickThree(type);
                break;
            case R.id.tv_area:
                if (!isChange4) {
                    if (!lengthPopWindow.isShowing()) {
                        setTextViewBg(binding.tvArea, R.drawable.search_bg, R.mipmap.icon_down_red, R.color.color_main);
                        setDrwImage(binding.tvArea, 0);
                    }
                } else {
                    if (!lengthPopWindow.isShowing()) {
                        setDrwImage(binding.tvArea, 0);
                    }
                }
                clickFour(type);
                break;
            case R.id.tv_more_choose:
                if (listPrice != null && listPrice.size() > 0) {
                    moreWindow.showPopwindowRight(binding.roomLayout);
                } else {
                    model.getPriceOptionByNo(2);
                }
                break;
        }
    }

    private void setTextViewBg(TextView textView, int bg, int img, int textColor) {
        textView.setBackground(getResources().getDrawable(bg));
        Drawable drawable_n = getResources().getDrawable(img);
        drawable_n.setBounds(0, 0, drawable_n.getMinimumWidth(), drawable_n.getMinimumHeight());
        textView.setCompoundDrawables(null, null, drawable_n, null);
        textView.setTextColor(getResources().getColor(textColor));
    }

    private void setDrwImage(TextView tv, int type) {
        Drawable img_off;
        Resources res = getResources();
        if (type == 0) {
            img_off = res.getDrawable(R.mipmap.icon_up_red);
        } else if (type == 1) {
            img_off = res.getDrawable(R.mipmap.icon_down_red);
        } else {
            img_off = res.getDrawable(R.mipmap.ic_down_arrow_n);
        }
        img_off.setBounds(0, 0, img_off.getMinimumWidth(), img_off.getMinimumHeight());
        tv.setCompoundDrawables(null, null, img_off, null); //设置右图标
    }

    private void setDataLoadMore(String type, boolean isRefresh) {
        switch (type) {
            case "商标":
                if (isRefresh) {
                    trademarkPageNumber = 1;
                } else {
                    trademarkPageNumber++;
                }
                Map<String, Object> map = new HashMap<>();
                map.put("categoryNo", tradeType);
                map.put("minPrice", minPrice);
                map.put("maxPrice", maxPrice);
                map.put("maxLength", charLength);
                map.put("pageNum", trademarkPageNumber);
                map.put("pageSize", 20);
                map.put("type", groupType);
                break;
            case "版权":
                if (isRefresh) {
                    copyrightPageNumber = 1;
                } else {
                    copyrightPageNumber++;
                }
                Map<String, Object> map2 = new HashMap<>();
                map2.put("authorizationMethod", isOnce);
                map2.put("category", tradeType);
                map2.put("minPrice", minPrice);
                map2.put("maxPrice", maxPrice);
                map2.put("pageNum", copyrightPageNumber);
                map2.put("pageSize", 20);
                break;
            case "专利":
                if (isRefresh) {
                    patentPageNumber = 1;
                } else {
                    patentPageNumber++;
                }
                Map<String, Object> map3 = new HashMap<>();
                map3.put("categoryNo", patentType);
                map3.put("industry", tradeType);
                map3.put("minPrice", minPrice);
                map3.put("maxPrice", maxPrice);
                map3.put("pageNum", patentPageNumber);
                map3.put("pageSize", 20);
                map3.put("talentStatus", patentStatus);
                break;
            case "公司":
                if (isRefresh) {
                    isLoadMore = false;
                    companyPageNumber = 1;
                } else {
                    isLoadMore = true;
                    companyPageNumber++;
                }
                if (!TextUtils.isEmpty(category)) {
                    if (TextUtils.isEmpty(tradeType)) {
                        tradeType = category;
                    }
                    setTextViewBg(binding.tvType, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
                    isChange1 = true;
                }
                Map<String, Object> map4 = new HashMap<>();
                map4.put("taxScale", ratePayingType);
                map4.put("enterpriseType", companyType);
                map4.put("minPrice", minPrice);
                map4.put("maxPrice", maxPrice);
                map4.put("page", companyPageNumber);
                map4.put("limit", 20);
                map4.put("categoryNo", tradeType);
                map4.put("publishType", publishType);
                model.getCompanyList(map4);
                break;
            case "资产":
                if (isRefresh) {
                    isLoadMore = false;
                    propertyPageNumber = 1;
                } else {
                    isLoadMore = true;
                    propertyPageNumber++;
                }
                if (!TextUtils.isEmpty(category)) {
                    if (TextUtils.isEmpty(propertyType)) {
                        propertyType = category;
                    }
                    setTextViewBg(binding.tvType, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
                    isChange1 = true;
                }
                Map<String, Object> map5 = new HashMap<>();
                map5.put("newOrOld", newOrOld);
                map5.put("startMoney", minPrice);
                map5.put("endMoney", maxPrice);
                map5.put("page", propertyPageNumber);
                map5.put("limit", 20);
                map5.put("assetsType", propertyType);
                map5.put("publishType", publishType);
                map5.put("timeAscIndex", true);
                model.getPropertyList(map5);
                break;
        }
    }

    private void initText(String type) {
        switch (type) {
            case "商标":
                binding.tvType.setText("商标分类");
                binding.tvTime.setText("组合类型");
                binding.tvMoney.setText("字符长度");
                binding.tvArea.setVisibility(View.GONE);
                break;
            case "版权":
                binding.tvType.setText("版权分类");
                binding.tvTime.setText("转让价格");
                binding.tvMoney.setText("发布类型");
                binding.tvArea.setVisibility(View.GONE);
                break;
            case "专利":
                binding.tvType.setText("行业分类");
                binding.tvTime.setText("专利类型");
                binding.tvMoney.setText("专利状态");
                binding.tvArea.setVisibility(View.GONE);
                break;
            case "公司":
                binding.tvType.setText("行业类型");
                binding.tvTime.setText("企业类型");
                binding.tvMoney.setText("纳税规模");
                binding.tvArea.setVisibility(View.GONE);
                binding.tvMoreChoose.setVisibility(View.VISIBLE);
                break;
            case "资产":
                binding.tvType.setText("资产类型");
                binding.tvTime.setText("转让价格");
                binding.tvMoney.setText("发布类型");
                binding.tvArea.setText("资产新旧");
                binding.tvMoreChoose.setVisibility(View.GONE);
                binding.tvArea.setVisibility(View.GONE);
                break;
        }
    }
    private List<IpPickSelectEntity> industryDatas = new ArrayList<>();

    private void clickOne(String type) {
        switch (type) {
            case "商标":
                model.getTrademarkTypeOption();
                break;
            case "版权":
                model.getCopyrightTypeOption();
                break;
            case "专利":
            case "公司":
                if (industryDatas != null && industryDatas.size() > 0) {
                    brandPopWindow.showPopwindow(binding.roomLayout, 0, 0);
                } else {
                    model.queryIndustryCategry();
                }
                break;
            case "资产":
                if (industryDatas != null && industryDatas.size() > 0) {
                    brandPopWindow.showPopwindow(binding.roomLayout, 0, 0);
                } else {
                    model.queryPropertyType();
                }
                break;
        }
    }

    private void clickTwo(String type) {
        switch (type) {
            case "商标":
            case "版权":
            case "公司":
                model.getCompanyType();
                break;
            case "资产":
                model.getPriceOptionByNo(3);
                break;
            case "专利":
                model.queryPatentTypeOption();
                break;
        }
    }

    private void clickThree(String type) {
        switch (type) {
            case "商标":
                model.getTypeOption();
                break;
            case "版权":
                model.getIsOnlyOption();
                break;
            case "专利":
                break;
            case "公司":
                model.getRatePayingType();
                break;
            case "资产":
                model.getPublishTypeOption();
                break;
        }
    }

    private void clickFour(String type) {
        switch (type) {
            case "商标":
                model.getStrLengthOption();
                break;
            case "版权":
            case "专利":
                break;
            case "公司":
//                model.getRatePayingType();
                break;
            case "资产":
                model.getNewOrOldType();
                break;
        }
    }

    public void showBrandPopWindow(List<IpPickSelectEntity> oneData) {
        brandPopWindow.showPopwindow(binding.roomLayout, 0, 0);
        brandPopWindow.setData(oneData);
        this.industryDatas = oneData;
        List<String> categoryList = new ArrayList<>();
        for (IpPickSelectEntity entity : oneData) {
            categoryList.add(entity.getValue());
        }
        if (!TextUtils.isEmpty(category) && categoryList.size() > 0) {
            brandPopWindow.setDefItem(categoryList.indexOf(category));
        }
    }

    public void showPricePopWindow(List<IpPickSelectEntity> twoData, boolean isPrice) {
        if (isPrice) {
            List<IpPickSelectEntity> listChange = new ArrayList<>();
            listChange = PickPriceUtils.showPriceList(twoData);
            pricePopWindow.showPopwindow(binding.roomLayout, 0, 0);
            pricePopWindow.setData(listChange);
        } else {
            pricePopWindow.showPopwindow(binding.roomLayout, 0, 0);
            pricePopWindow.setData(twoData);
        }
    }

    public void showMakeupPopWindow(List<IpPickSelectEntity> threeData) {
        makeupPopWindow.showPopwindow(binding.roomLayout, 0, 0);
        makeupPopWindow.setData(threeData);
    }

    public void showLengthPopWindow(List<IpPickSelectEntity> fourData) {
        lengthPopWindow.showPopwindow(binding.roomLayout, 0, 0);
        lengthPopWindow.setData(fourData);
    }

    public void showPricePopWindow1(List<IpPickSelectEntity> priceDatas1) {
        this.listPrice = priceDatas1;
        moreWindow.showPopwindowRight(binding.roomLayout);
        moreWindow.setPriceData(priceDatas1);
    }

    public void getCompanyList(List<CompanyListEntity2> data) {
        binding.displayView.refreshComplete();
        if (isLoadMore) {
            if (null != data && data.size() > 0) {
                binding.displayView.loadMoreComplete();
                companyAdapter.addDatas(data);
            } else {
                binding.displayView.setNoMore(true);
            }
            binding.displayView.setVisibility(View.VISIBLE);
        } else {
            binding.displayView.refreshComplete();
            if (null != data && data.size() > 0) {
                binding.displayView.setVisibility(View.VISIBLE);
                binding.errorView.setVisibility(View.GONE);
                companyAdapter.setDatas(data);
                binding.displayView.setLoadingMoreEnabled(true);
            } else {
                companyAdapter.setDatas(null);
                binding.displayView.setVisibility(View.GONE);
                binding.errorView.setVisibility(View.VISIBLE);
            }
        }
    }

    public void getPropertyList(List<PropertyEntity> data) {
        binding.displayView.refreshComplete();
        if (isLoadMore) {
            if (null != data && data.size() > 0) {
                binding.displayView.loadMoreComplete();
                propertyAdapter.addDatas(data);
            } else {
                binding.displayView.setNoMore(true);
            }
            binding.displayView.setVisibility(View.VISIBLE);
        } else {
            binding.displayView.refreshComplete();
            if (null != data && data.size() > 0) {
                binding.displayView.setVisibility(View.VISIBLE);
                binding.errorView.setVisibility(View.GONE);
                propertyAdapter.setDatas(data);
                binding.displayView.setLoadingMoreEnabled(true);
            } else {
                propertyAdapter.setDatas(null);
                binding.displayView.setVisibility(View.GONE);
                binding.errorView.setVisibility(View.VISIBLE);
            }
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onEvent(LoginEvent event) {
        if (event.getMessageTag() == EventConstant.EVENT_MAKE_OVER_JUMP) {
            setDataLoadMore(type, true);
        }
    }
}
